package com.study.Utils;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class FileWriterUtils {

    public static String writerHtml(String html,String name){
        String path="D:\\project-soft\\data\\"+name+".html";
        File file = new File(path);
        if (!file.exists()){
            try {
                file.createNewFile();
                //写文件
                FileWriter fileWriter = new FileWriter(file.getAbsoluteFile());
                BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
                bufferedWriter.write(html);
                bufferedWriter.close();
            } catch (IOException e) {
                e.printStackTrace();
                return null;
            }
        }
        return path;
    }

}
